package com.gxa.hualian.common;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @Author ChenJin
 * @date 2021/09/13 19:19
 **/
public class JsonResult implements Serializable {
    private String code;
    private String msg;
    private Object data;

    /**
     * 如果最终给前端返回数据中又其他参数，可以通过一个Map来补充
     */
    private Map<String,Object> dataMap = new HashMap<>(16);


    public Map<String, Object> getDataMap() {
        return dataMap;
    }

    public void put(String key,Object value) {
        dataMap.put(key,value);
    }


    public JsonResult() {
    }

    public JsonResult(String code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public String getCode() {
        return dataMap.get("code").toString();
    }

    public void setCode(String code) {
        dataMap.put("code",code);
    }

    public String getMsg() {
        return dataMap.get("msg").toString();
    }

    public void setMsg(String msg) {
        dataMap.put("msg",msg);
    }

    public Object getData() {
        return dataMap.get("data");
    }

    public void setData(Object data) {
        dataMap.put("data", data);
    }
}
